Question: In the diagram, what is the perimeter of polygon $PQRST$? [asy]

import olympiad;

size(6cm); // ADJUST

pair p = (0, 6);
pair q = (3, 6);

pair r = (3, 3);
pair t = (0, 0);
pair s = (7, 0);

draw(p--q--r--s--t--cycle);
label("$P$", p, NW);
label("$Q$", q, NE);
label("$R$", r, E + NE);
label("$S$", s, SE);
label("$T$", t, SW);

label("$6$", p / 2, W);
label("$3$", p + (q - p) / 2, 2 * N);
label("$7$", s / 2, S);

draw(rightanglemark(p, t, s));
draw(rightanglemark(t, p, q));
draw(rightanglemark(p, q, r));
add(pathticks(p--q, s=6));
add(pathticks(q--r, s=6));
[/asy]
Solution: We extend $QR$ to meet $TS$ at $X$. [asy]
import olympiad;
size(6cm); // ADJUST

pair p = (0, 6);
pair q = (3, 6);

pair r = (3, 3);
pair t = (0, 0);
pair s = (7, 0);
pair x = (3, 0);

draw(p--q--r--s--t--cycle);
draw(r--x);

label("$P$", p, NW);
label("$Q$", q, NE);
label("$R$", r, E + NE);
label("$S$", s, SE);
label("$T$", t, SW);
label("$X$", x, S);

label("$6$", p / 2, W);
label("$3$", p + (q - p) / 2, 2 * N);
label("$3$", x + (r - x) / 2, W);
label("$4$", x + (s - x) / 2, S);
label("$3$", x / 2, S);
label("$3$", r + (q - r) / 2, 2 * E);

draw(rightanglemark(p, t, s));
draw(rightanglemark(t, p, q));
draw(rightanglemark(p, q, r));
add(pathticks(p--q, s=6));
add(pathticks(q--r, s=6));
[/asy] Since $PQ=QR$, then $QR=3$.

Since $PQXT$ has three right angles, it must be a rectangle, so $TX=PQ=3$. Also, $QX=PT=6$.

Since $TS=7$ and $TX=3$, then $XS=TS-TX=7-3=4$.

Since $QX=6$ and $QR=3$, then $RX=QX-QR=6-3=3$.

Since $PQXT$ is a rectangle, then $\angle RXS=90^\circ$.

By the Pythagorean Theorem in $\triangle RXS$, \[ RS^2 = RX^2 + XS^2 = 3^2 + 4^2 = 9+16=25 \]so $RS=5$, since $RS>0$.

Therefore, the perimeter is $$PQ+QR+RS+ST+TP=3+3+5+7+6=\boxed{24}.$$